import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import reducer from './reducer'

// composeEnhancers函数 方便浏览器调试
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ trace: true }) || compose;

const storeEnhancer = applyMiddleware(thunk)  // 应用 中间件

// 开发的时候
const store = createStore(reducer, composeEnhancers(storeEnhancer))

// 打包的时候
// const store = createStore(reducer, storeEnhancer)
export default store